package org.trebert.j2ee;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class OKServlet extends HttpServlet {
	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException{
		PrintWriter out = response.getWriter();
		out.println("<html><head><title>ausgabe</title></head>");
		out.println("Hier ist OKServlet");
		
		String s1 = getServletConfig().getInitParameter("wert1");
		ServletConfig sc = getServletConfig();
		String s2 = sc.getInitParameter("wert2");
		out.print(s1+" "+s2);
		
		getServletContext().log("Logeintrag: bin im OKServlet");
		String ok = request.getParameter("ok");
		RequestDispatcher rd;
		if (ok == null){
			rd = request.getRequestDispatcher("/fehler.jsp");
		}else{
			MyBean mb = new MyBean();
			request.setAttribute("MyBean",mb);
			rd = request.getRequestDispatcher("/ok.jsp");
		}
		out.println("</body></html>");
//		rd.forward(request, response);		
	}
}
